class SRVetSaboteur extends SRVeterancy
	abstract;

static function int GetPerkProgressInt( ClientPerkRepLink StatOther, out int FinalInt, byte CurLevel, byte ReqNum )
{
	switch( CurLevel )
	{
	case 0:
		FinalInt = 0;
		break;
	case 1:
		FinalInt = 500000; // 0.5M
		break;
	case 2:
		FinalInt = 1500000; // 1M
		break;
	case 3:
		FinalInt = 3500000; // 2M
		break;
	case 4:
		FinalInt = 6000000; // 2.5M
		break;
	case 5:
		FinalInt = 10000000; // 4M
		break;
	case 6:
		FinalInt = 17000000; // 7M
		break;
	case 7:
		FinalInt = 27000000; // 10M
		break;
	case 8:
		FinalInt = 40000000; // 13M
		break;
	default:
		FinalInt = 60000000 * ( CurLevel - 8 ); // 20M
	}
	return Min(StatOther.RFeedingKillsStat,FinalInt);
}

static function int AddDamage(KFPlayerReplicationInfo KFPRI, KFMonster Injured, KFPawn DamageTaker, int InDamage, class<DamageType> DmgType)
{
	local float ret;

//	if( class<DamTypeSMG>(DmgType) != none )
//	{
//		return (1.32 + (0.02 * float(Min(9,KFPRI.ClientVeteranSkillLevel)))) * Super.AddDamage(KFPRI,Injured,DamageTaker,InDamage,DmgType);
//		return 2.0 * Super.AddDamage(KFPRI,Injured,DamageTaker,InDamage,DmgType);
//	}

	if ( KFGameType(KFPRI.Level.Game).bZedTimeActive )
	{
		ret = 1.00 + FMax(0.00,((1.10/KFPRI.Level.TimeDilation)-1.00));
	}
	else
	{
		ret = 1.00;
	}

	return ret * Super.AddDamage(KFPRI,Injured,DamageTaker,InDamage,DmgType);
}

static function class<DamageType> GetMAC10DamageType(KFPlayerReplicationInfo KFPRI)
{
	return class'DamTypeMAC10MPSmg';
}

static function class<Grenade> GetNadeType(KFPlayerReplicationInfo KFPRI)
{
	return class'StunningNade';
}

static function bool CanBeGrabbed(KFPlayerReplicationInfo KFPRI, KFMonster Other)
{
	if ( KFPRI.ClientVeteranSkillLevel > 2 )
		return !( Other.Isa('ZombieClot') || Other.Isa('DKClot') );
	return true;
}

static function float GetMeleeMovementSpeedModifier(KFPlayerReplicationInfo KFPRI)
{
	return 0.00;
}

static function float GetMovementSpeedModifier(KFPlayerReplicationInfo KFPRI, KFGameReplicationInfo KFGRI)
{
	local float ret;

	if ( KFPRI.ClientVeteranSkillLevel < 1 )
		ret = 1.12;
	if ( KFPRI.ClientVeteranSkillLevel < 2 )
		ret = 1.14;
	if ( KFPRI.ClientVeteranSkillLevel < 3 )
		ret = 1.16;
	if ( KFPRI.ClientVeteranSkillLevel < 4 )
		ret = 1.20;
	if ( KFPRI.ClientVeteranSkillLevel < 5 )
		ret = 1.22;
	if ( KFPRI.ClientVeteranSkillLevel < 6 )
		ret = 1.24;
	if ( KFPRI.ClientVeteranSkillLevel < 7 )
		ret = 1.26;
	if ( KFPRI.ClientVeteranSkillLevel < 8 )
		ret = 1.28;
	if ( KFPRI.ClientVeteranSkillLevel < 9 )
		ret = 1.30;
	if ( KFPRI.ClientVeteranSkillLevel > 8 )
		ret = 1.32;
		
	if ( KFGameType(KFPRI.Level.Game).bZedTimeActive )
	{
		ret *= FMax(1.0,1.1/KFPRI.Level.TimeDilation);
	}
	
	if ( Knife(SRPlayerReplicationInfo(KFPRI).Controller.Pawn.Weapon) != none 
		|| Machete(SRPlayerReplicationInfo(KFPRI).Controller.Pawn.Weapon) != none )
	{
		ret = FMax(1.1,ret);
	}
	
	return ret * Super.GetMovementSpeedModifier(KFPRI,KFGRI);
}

static function float GetMagCapacityMod(KFPlayerReplicationInfo KFPRI, KFWeapon Other)
{
	if ( Mac10MP(Other) != none || AFS12a(Other) != none || Bal_MP5MMedicGun(Other) != none
		|| UMP45SubmachineGun(Other) != none || AK74u(Other) != none || HKMP7LLI(Other) != none
		|| P90DT(Other) != none || ThompsonNew(Other) != none || OC33LLI(Other) != none
		|| PP19AssaultRifle(Other) != none )
		return ( 1.25 + 0.05 * float(Min(9,KFPRI.ClientVeteranSkillLevel)) ) * GetProperMagCapacity(Other);
		
//	if ( PP19AssaultRifle(Other) != none )
//		return ( 1.125 + 0.025 * float(Min(9,KFPRI.ClientVeteranSkillLevel)) ) * GetProperMagCapacity(Other);

	return GetProperMagCapacity(Other);
}

static function float GetAmmoPickupMod(KFPlayerReplicationInfo KFPRI, KFAmmunition Other)
{
	if ( Mac10Ammo(Other) != none || AFS12Ammo(Other) != none || Bal_MP5MAmmo(Other) != none
		|| UMP45Ammo(Other) != none || AK74uAmmo(Other) != none || MP7Ammo(Other) != none
		|| P90DTAmmo(Other) != none || G2ContenderDTAmmo(Other) != none || ThompsonNewAmmo(Other) != none
		|| OC33LLIAmmo(Other) != none || PP19Ammo(Other) != none )
	{
		return ( 1.25 + 0.05 * float(Min(9,KFPRI.ClientVeteranSkillLevel)) ) * GetProperAmmoPickupAmount(Other);
	}
		
//	if ( PP19Ammo(Other) != none )
//	{
//		return ( 1.125 + 0.025 * float(Min(9,KFPRI.ClientVeteranSkillLevel)) ) * GetProperAmmoPickupAmount(Other);
//	}

	return GetProperAmmoPickupAmount(Other);
}

static function float AddExtraAmmoFor(KFPlayerReplicationInfo KFPRI, Class<Ammunition> AmmoType)
{
	local float ret;
	
	ret = 1.00;

	if ( AmmoType == class'FragAmmo' || AmmoType == class'Frag1Ammo' )
	{
		if ( KFPRI.ClientVeteranSkillLevel < 7 )
		{
			ret = 1.2 + 0.2 * float(KFPRI.ClientVeteranSkillLevel);
		}
		else if ( KFPRI.ClientVeteranSkillLevel < 10 )
		{
			ret = 2.4 + 0.4 * float(KFPRI.ClientVeteranSkillLevel-6);
		}
		else // if ( KFPRI.ClientVeteranSkillLevel >= 10 )
		{
			ret = 3.6;
		}
	}
	
	if ( AmmoType == class'TacticalMineAmmo' )
		ret = ( 1.0 + 0.5 * float(Min(9,KFPRI.ClientVeteranSkillLevel)) );

	if ( AmmoType == class'Mac10Ammo' || AmmoType == class'AFS12Ammo' || AmmoType == class'Bal_MP5MAmmo'
		|| AmmoType == class'UMP45Ammo' || AmmoType == class'AK74uAmmo' || AmmoType == class'MP7Ammo'
		|| AmmoType == class'P90DTAmmo' || AmmoType == class'G2ContenderDTAmmo' || AmmoType == class'ThompsonNewAmmo'
		|| AmmoType == class'OC33LLIAmmo' || AmmoType == class'PP19Ammo' )
	{
		ret = ( 1.25 + 0.05 * float(Min(9,KFPRI.ClientVeteranSkillLevel)) );
//		if ( AmmoType != class'AFS12Ammo' )
//			ret *= 1.50;
	}
		
//	if ( AmmoType == class'PP19Ammo' )
//	{
//		ret = ( 1.125 + 0.025 * float(Min(9,KFPRI.ClientVeteranSkillLevel)) );
//		ret *= 1.50;
//	}

	return ret * GetProperAmmoAmount(AmmoType);
}

static function float GetFireSpeedMod(KFPlayerReplicationInfo KFPRI, Weapon Other)
{
	if ( AFS12a(Other) == none && IsBelongToPerk(KFPRI,Other.PickupClass) )
	{
		return ( 1.25 + (0.05 * float(Min(9,KFPRI.ClientVeteranSkillLevel))) ) * Super.GetFireSpeedMod(KFPRI,Other); // Up to 70% faster fire rate
	}
	return Super.GetFireSpeedMod(KFPRI,Other);
}

static function float ModifyRecoilSpread(KFPlayerReplicationInfo KFPRI, WeaponFire Other, out float Recoil)
{
	Recoil = 0.56 - 0.04 * float(Min(9,KFPRI.ClientVeteranSkillLevel));
	return Recoil * GetProperRecoilSpread(Other);
}

static function float GetReloadSpeedModifier(KFPlayerReplicationInfo KFPRI, KFWeapon Other)
{
	local float ret;

	ret = 0.00;

	if (  IsBelongToPerk(KFPRI,Other.PickupClass) )
	{
		ret += 1.15 + 0.05 * float(Min(3,KFPRI.ClientVeteranSkillLevel));
	}
	else
	{
		ret = 1.00;
	}
	
	return ret * Super.GetReloadSpeedModifier(KFPRI,Other);
}

static function bool IsBelongToPerk(KFPlayerReplicationInfo KFPRI, Class<Pickup> PickupClass)
{
	if ( PickupClass == class'Mac10NewPickup' || PickupClass == class'PP19Pickup' || PickupClass == class'AFS12Pickup'
		|| PickupClass == class'Bal_MP5MPickup' || PickupClass == class'UMP45Pickup' || PickupClass == class'AK74uPickup'
		|| PickupClass == class'TacticalMinePickup' || PickupClass == class'MP7Pickup' || PickupClass == class'G2ContenderDTPickup'
		|| PickupClass == class'P90DTPickup' || PickupClass == class'ThompsonNewPickup' || PickupClass == class'OC33LLIPickup' )
	return true;

	return Super.IsBelongToPerk(KFPRI,PickupClass);
}

static function float GetCostScaling(KFPlayerReplicationInfo KFPRI, class<Pickup> Item)
{
	if ( IsBelongToPerk(KFPRI,Item) )
	{
		return GetDefaultCostScaling(KFPRI.ClientVeteranSkillLevel) * GetProperCostScaling(Item);
	}
	return GetProperCostScaling(Item);
}

static function float GetAmmoCostScaling(KFPlayerReplicationInfo KFPRI, class<Pickup> Item)
{
	if ( Item == class'TacticalMinePickup' )
	{
		return GetDefaultCostScaling(KFPRI.ClientVeteranSkillLevel) * GetProperAmmoCostScaling(Item);
		
	}
	return GetProperAmmoCostScaling(Item);
}

// Give Extra Items as default
static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
	super.AddDefaultInventory(KFPRI,P);
	
	if ( SRPlayerReplicationInfo(KFPRI).bRespawned )
		return;

	if ( KFPRI.ClientVeteranSkillLevel > 2 && KFPRI.ClientVeteranSkillLevel < 9  )
		KFHumanPawn(P).CreateInventoryVeterancy("ServerPerksV4C.ThompsonNew", GetCostScaling(KFPRI, class'ThompsonNewPickup'));

	if ( KFPRI.ClientVeteranSkillLevel > 5 && KFPRI.ClientVeteranSkillLevel < 9 )
		KFHumanPawn(P).CreateInventoryVeterancy("ServerPerksV4C.UMP45SubmachineGun", GetCostScaling(KFPRI, class'UMP45Pickup'));

	if ( KFPRI.ClientVeteranSkillLevel > 8 )
	{
		KFHumanPawn(P).CreateInventoryVeterancy("ServerPerksV4C.AFS12a", GetCostScaling(KFPRI, class'AFS12Pickup'));
		KFHumanPawn(P).CreateInventoryVeterancy("ServerPerksV4C.P90DT", GetCostScaling(KFPRI, class'P90DTPickup'));
	}

	SRPlayerReplicationInfo(KFPRI).bRespawned = true;
}

static function bool IsPerkTarget(PlayerReplicationInfo PRI, class<Actor> TargetClass)
{
	if ( TargetClass == class'DKShiver' )
	{
		return true;
	}

	return Super.IsPerkTarget(PRI,TargetClass);
}

static function string GetPickupShopName(KFPlayerReplicationInfo KFPRI, Class<Pickup> PickupClass, optional int FireModeNum)
{
	if ( PickupClass == class'Frag1Pickup' )
		return "Stun Nade";
	
	return Super.GetPickupShopName(KFPRI,PickupClass);
}

defaultproperties
{
     CustomLevelInfo="%r extra melee damage|%s faster melee attacks|20% faster melee movement|80% less damage from Bloat Bile|%l resistance to all damage|%d discount on Katana/Chainsaw|Spawn with a Chainsaw and Body Armor|Can't be paralized by Clots|Up to 4 Zed-Time Extensions"
     PerkIndex=7
	 BronzeIcon=Texture'SunriseHUD.Icons.Perk_Saboteur_Bronze'
	 SilverIcon=Texture'SunriseHUD.Icons.Perk_Saboteur_Silver'
	 GoldIcon=Texture'SunriseHUD.Icons.Perk_Saboteur_Gold'
     OnHUDIcon=Texture'SunriseHUD.Icons.Perk_Saboteur_red'
     OnHUDGoldIcon=Texture'SunriseHUD.Icons.Perk_Saboteur_gold'
     VeterancyName="Saboteur"
     Requirements(0)="Deal %x damage with submachine guns"
     SRLevelEffects(0)="25% faster submachine guns fire speed|12% faster movement speed|25% submachine guns mag capacity|44% less recoil with submachine guns|Grenades stun enemies|50% discount on submachine guns"
     SRLevelEffects(1)="30% faster submachine guns fire speed|14% faster movement speed|30% submachine guns mag capacity|48% less recoil with submachine guns|Grenades stun enemies|20% extra grenade capacity|Can carry 3 tactical mines|55% discount on submachine guns"
     SRLevelEffects(2)="35% faster submachine guns fire speed|16% faster movement speed|35% submachine guns mag capacity|52% less recoil with submachine guns|Grenades stun enemies|40% extra grenade capacity|Can carry 4 tactical mines|60% discount on submachine guns"
     SRLevelEffects(3)="40% faster submachine guns fire speed|20% faster movement speed|40% submachine guns mag capacity|56% less recoil with submachine guns|Grenades stun enemies|60% extra grenade capacity|Can carry 5 tactical mines|65% discount on submachine guns|Can't be paralized by Clots|Spawn with a Thompson M1"
     SRLevelEffects(4)="45% faster submachine guns fire speed|22% faster movement speed|45% submachine guns mag capacity|60% less recoil with submachine guns|Grenades stun enemies|80% extra grenade capacity|Can carry 6 tactical mines|70% discount on submachine guns|Can't be paralized by Clots|Spawn with a Thompson M1"
     SRLevelEffects(5)="50% faster submachine guns fire speed|24% faster movement speed|50% submachine guns mag capacity|64% less recoil with submachine guns|Grenades stun enemies|100% extra grenade capacity|Can carry 7 tactical mines|70% discount on submachine guns|Can't be paralized by Clots|Spawn with a Thompson M1"
     SRLevelEffects(6)="55% faster submachine guns fire speed|26% faster movement speed|55% submachine guns mag capacity|68% less recoil with submachine guns|Grenades stun enemies|120% extra grenade capacity|Can carry 8 tactical mines|70% discount on submachine guns|Can't be paralized by Clots|Spawn with a Thompson M1 and UMP45"
	 SRLevelEffects(7)="60% faster submachine guns fire speed|28% faster movement speed|60% submachine guns mag capacity|72% less recoil with submachine guns|Grenades stun enemies|140% extra grenade capacity|Can carry 9 tactical mines|75% discount on submachine guns|Can't be paralized by Clots|Spawn with a Thompson M1 and UMP45"
     SRLevelEffects(8)="65% faster submachine guns fire speed|30% faster movement speed|65% submachine guns mag capacity|76% less recoil with submachine guns|Grenades stun enemies|160% extra grenade capacity|Can carry 10 tactical mines|75% discount on submachine guns|Can't be paralized by Clots|Spawn with a Thompson M1 and UMP45"
     SRLevelEffects(9)="70% faster submachine guns fire speed|32% faster movement speed|70% submachine guns mag capacity|80% less recoil with submachine guns|Grenades stun enemies|180% extra grenade capacity|Can carry 11 tactical mines|80% discount on submachine guns|Can't be paralized by Clots|Spawn with an AFS12 and P90"
     SRLevelEffects(10)="70% faster submachine guns fire speed|32% faster movement speed|70% submachine guns mag capacity|80% less recoil with submachine guns|Grenades stun enemies|180% extra grenade capacity|Can carry 11 tactical mines|80% discount on submachine guns|Can't be paralized by Clots|Spawn with an AFS12,P90 and 100 armor|Elite abilities:|70% extra headshot damage with 9mm tactical|Null collision with zeds and human|Weapon Mastery - 100% extra headshot damage with Machine Pistol"
}